package com.tcm.item.domain.enums;

import com.base.core.result.ResponseCodeEnum;

/**
 * 错误码枚举类
 *
 * 商品系统，使用 1-003-000-000 段
 */
public enum BusinessCodeEnum implements ResponseCodeEnum {

    // ========== PRODUCT CATEGORY 模块 ==========
    PRODUCT_CATEGORY_PARENT_NOT_EXISTS(1003001000, "父分类不存在"),
    PRODUCT_CATEGORY_NOT_EXISTS(1003001001, "分类不存在"),
    PRODUCT_CHILD_CATEGORY_EXISTS(1003001003, "子类存在，请先删除子类"),
    PRODUCT_CATEGORY_PARENT_NOT_SELF(1003001002, "不能设置自己为父分类"),
    PRODUCT_CATEGORY_STATUS_EQUALS(1002001003, "分类已经是该状态"),
    PRODUCT_CATEGORY_DELETE_ONLY_DISABLE(1002001004, "只有关闭的分类才可以删除"),
    PRODUCT_CATEGORY_MUST_ENABLE(1002001005, "只有开启的分类，才可以使用"),
    PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEAF(1002001005, "父分类必须是叶子(最后一级)分类"),
    PRODUCT_DOSAGE_FORM_CAN_NOT_DUPLICATE(1002001006, "剂型名称不能重复"),

    // ========== PRODUCT SPU + SKU 模块 ==========
    PRODUCT_SKU_ATTR_CANT_NOT_DUPLICATE(1003002000, "同一个供应商下，不能有同样的商品"),
    PRODUCT_SUPPLIER_NOT_EXISTS(1003002003, "供应商不存在"),
    PRODUCT_SPU_CATEGORY_MUST_BE_LEAF(1003002003, "只能添加在最后一级分类下"),
    PRODUCT_QUANTITY_NOT_EMPTY(1003002004,"商品数量不能为空"),
    PRODUCT_ID_NOT_EXISTS(1003002005, "主键ID不存在"),

    // ========== PRODUCT ATTR + ATTR_VALUE 模块 ==========
    PRODUCT_ATTR_VALUE_NOT_EXIST(1003003000, "属性值不存在"),
    PRODUCT_ATTR_NOT_EXIST(1003003001, "属性不存在"),
    PRODUCT_ATTR_VALUE_LIST_NOT_EXIST(1003003007, "属性值集合不存在"),
    PRODUCT_ATTR_EXISTS(1003003002, "属性已经存在"),
    PRODUCT_ATTR_CLASS_NAME_EXISTS(1003003006, "品类名称已经存在"),
    PRODUCT_ATTR_STATUS_EQUALS(1003003003, "属性已经是该状态"),
    PRODUCT_ATTR_VALUE_EXISTS(1003003004, "属性值已经存在"),
    PRODUCT_ATTR_VALUE_STATUS_EQUALS(1003003005, "属性值已经是该状态"),

    //================供应商模块 ======================
    SUPPLIER_NAME_NOT_DUPLICATE(1003004001,"供应商不能重复"),
    SUPPLIER_ID_NOT_EXISTS(1003004002, "主键ID不存在"),
    SUPPLIER_INTRODUCE_NOT_DUPLICATE(1003004003, "供应商简介内容不能重复"),
    SUPPLIER_INTRODUCE_NOT_EXISTS(1003004004, "要更新的供应商简介内容不存在"),
    ;


    private final int code;
    private final String message;

    BusinessCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

}